#!groovy

@Library('library-test') _

def tools = new org.devops.tools()
def changeSlb = new org.devops.changeSlb()


pipeline {
    agent { node {  label "master"}}

    options {
        timestamps()
        skipDefaultCheckout()
        disableConcurrentBuilds()
        buildDiscarder(logRotator(numToKeepStr: '5')) 
        timeout(time: 1, unit: 'HOURS')
    }
    stages {
        stage("umount 59"){
                    steps{
                        timeout(time:20, unit:"MINUTES"){
                            script{
                                  print('卸载节点')
                                  tools.PrintMes("卸载节点172.16.106.59",'green')
                                  changeSlb.umountSlb("172.16.106.59")
                                  
                            }
                        }
                    }
                }
        
        stage("mount 59"){
                    steps{
                        input id: '1', message: '是否恢复节点172.16.106.59', ok: '确定'
                        timeout(time:20, unit:"MINUTES"){
                            script{
                                  print('恢复节点')
                                  tools.PrintMes("恢复节点172.16.106.59",'green')
                                  changeSlb.mountSlb("172.16.106.59")
                            }
                        }
                    }
                }
        stage("umount 65"){
                    steps{
                        timeout(time:20, unit:"MINUTES"){
                            script{
                                  print('卸载节点')
                                  tools.PrintMes("卸载节点172.16.106.65",'green')
                                  changeSlb.umountSlb("172.16.106.65")
                            }
                        }
                    }
                }
        stage("mount 65"){
                    steps{
                        input id: '2', message: '是否恢复节点172.16.106.65', ok: '确定'
                        timeout(time:20, unit:"MINUTES"){
                            script{
                                  print('恢复节点')
                                  tools.PrintMes("恢复节点172.16.106.65",'green')
                                  changeSlb.mountSlb("172.16.106.65")
                            }
                        }
                    }
                }
                
        
    }

}